<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vue制作弹窗</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="app">
        <button @click="showModal = true" class="button">点我弹窗</button>
        <transition name="fade" appear>
            <div
                class="modal-overlay"
                v-if="showModal"
                @click="showModal = false"
            ></div>
        </transition>
        <transition name="pop" appear>
            <div class="modal" role="dialog" v-if="showModal">
                <h1>Vue Transition</h1>
                <p>
                     <code>&lt;transition&gt;</code> 组件可以创造出美妙绝伦的动画
                </p>
                <button @click="showModal = false" class="button">
                    隐藏弹窗
                </button>
            </div>
        </transition>
    </div>
    <script src='https://cdn.jsdelivr.net/npm/vue'></script>
    
    <script>
        
        new Vue({
            el: '#app',

            data() {
                return {
                    showModal: true
                }
            } 
        });
    </script>
</body>
</html>
